

#ifndef RTREACTORSELECT_H
#define RTREACTORSELECT_H

#include "RtReactorBase.h"
#include "RtReactorNotifyPipe.h"

class CRtReactorSelect : public CRtReactorBase  
{
public:
	CRtReactorSelect();
	virtual ~CRtReactorSelect();

	// interface IRtReactor
	virtual RtResult Open();

	virtual RtResult NotifyHandler(
		IRtEventHandler *aEh, 
		IRtEventHandler::MASK aMask);

	virtual RtResult RunEventLoop();

	virtual RtResult StopEventLoop();
	
	virtual RtResult Close();

protected:
	virtual RtResult OnHandleRegister(RT_HANDLE aFd, 
		IRtEventHandler::MASK aMask, IRtEventHandler *aEh);
	virtual void OnHandleRemoved(RT_HANDLE aFd);

	void ProcessFdSets_i(
		fd_set &aFdSet, 
		IRtEventHandler::MASK aMask, 
		int &aActiveNumber, 
		int aMaxFd);

private:
	CRtReactorNotifyPipe m_Notify;
};

#endif // !RTREACTORSELECT_H
